(function ($) {
    // VERTICALLY ALIGN FUNCTION
    $.fn.vAlign = function() {
        return this.each(function(i){
            var ah = $(this).height();
            var ph = $(window).height();
            var mh = (ph - ah) / 2;
            if(mh>0) {
                $(this).css('margin-top', mh);
            } else {
                $(this).css('margin-top', 0);
            }
        });
    };
})(jQuery);

$(function(){
    $('#podziekowanie').hide();
    $('#zapisz').click(function() {
        $('#podziekowanie').show();
        $('#formularz').hide();
        return false;
    });
								        
});

$(document).ready(function(){
    $("#container").vAlign();
});
$(window).bind('resize', function(){
    $("#container").vAlign();
});


function validatorFormularza(EMAIL, URL)
{	 
    var u = URL + '/default/index/obslugaformularza/email/'+EMAIL;
    dojo.xhrGet({
        url: u,
        handleAs:"text",
        mimetype: "text/plain",
        sync:true,
        timeout:1000,
        error:function(response, ioArgs) {
            alert( response );
        },
        load: function(response, ioArgs)
        {
            $('#div_z_formularzem').html(response);
        }
    });	
}


